using Orchard;
using Orchard.ContentManagement;
using System.Collections.Generic;
using System.Web.Mvc;
using System;
using System.Linq;
using Dyn.News.ViewModels;
namespace Dyn.News.Models {
	
    public class NewsCategoryWidgetPart : ContentPart<NewsCategoryWidgetPartRecord> {
        public NewsCategoryWidgetPart()
        {
            ListViewType = Enum.GetNames(typeof(ViewType)).Select(p =>
            {
                return new SelectListItem
                {
                    Text = p,
                    Value = p
                };
            });
        }
        public ViewType ViewType
        {
            get { return (ViewType)Record.ViewType; }
            set { Record.ViewType = (int)value; }
        }
        public IEnumerable<NewsCategoryPartRecord> ContentCategoryWidgets
        {
            get { return Record.ContentCategoryWidgets.OrderBy(o => o.DisplayOrder).Select(p => p.NewsCategoryPartRecord); }
        }
        public IEnumerable<ContentCategoryWidgetViewModel> CategoryPartViewModels { get; set; }
        public IEnumerable<SelectListItem> ListViewType { get; set; }
    }
    public enum ViewType
    {
        Grid,
        List,
        CategorySlider1,
        CategorySlider2,
    }
}
